package com.example.goodsconsumer.feign;

import com.example.goodsconsumer.config.FeignConfig;
import com.example.goodsconsumer.hystrix.GoodsFeignHystrix;
import com.myshop.b2b.commonmodule.Cart;
import com.myshop.b2b.commonmodule.Goods;
import com.myshop.b2b.commonmodule.Userorder;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @author likaiping
 * @createTime 2024/7/3 16:14
 */
@Component
@FeignClient(value = "goods-provider",fallback = GoodsFeignHystrix.class,configuration = FeignConfig.class)
public interface GoodsFeign {
    @GetMapping("/getAllgoods")
    public List<Goods> getAllgoods();

    @GetMapping("/getOnegoods")
    public List<Goods> getOnegoods(@RequestParam("gname") String gname);

    @GetMapping("/getOnegid")
    public Goods getOnegid(@RequestParam("gid") int gid);


    @GetMapping("/updateCart")
    public int updateCart(@RequestParam("number") int number,
                          @RequestParam("id") int id);

    @GetMapping("/intcart")
    public int intcart(@RequestParam("goodsname") String goodsname,
                       @RequestParam("number") int number,
                       @RequestParam("price") int price,
                       @RequestParam("goodid") int goodid,
                       @RequestParam("uid") int uid);

    @GetMapping("/getAllcart")
    public List<Cart> getAllcart(@RequestParam("uid") int uid);




    @GetMapping("/deleteCart")
    public int deleteCart(@RequestParam("gid") int gid);

    @GetMapping("/insertOrder")
    public int insertOrder(@RequestParam("goodsname") String goodsname,
                           @RequestParam("number") int number,
                           @RequestParam("price")int price,
                           @RequestParam("uid")int uid);

    @GetMapping("/getAllorder")
    public List<Userorder> getAllorder(@RequestParam(value = "uid") int uid);

    @GetMapping("/editCartNum")
    boolean updateCartNumber(@RequestParam("number")int number,@RequestParam("id")int id);
}
